package com.ruoyi.storeroomuse.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.storeroomuse.vo.StoreUseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.storeroomuse.mapper.StoreroomUseMapper;
import com.ruoyi.storeroomuse.domain.StoreroomUse;
import com.ruoyi.storeroomuse.service.IStoreroomUseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 使用记录Service业务层处理
 * 
 * @author mqs
 * @date 2024-05-02
 */
@Service
public class StoreroomUseServiceImpl implements IStoreroomUseService 
{
    @Autowired
    private StoreroomUseMapper storeroomUseMapper;

    /**
     * 查询使用记录
     *
     * @param storeId 使用记录主键
     * @return 使用记录
     */
    @Override
    public StoreUseVO selectStoreroomUseByStoreId(Long storeId)
    {
        return storeroomUseMapper.selectStoreroomUseByStoreId(storeId);
    }

    /**
     * 查询使用记录列表
     *
     * @param storeUseVO 使用记录
     * @return 使用记录
     */
    @Override
    public List<StoreUseVO> selectStoreroomUseList(StoreUseVO storeUseVO)
    {
        return storeroomUseMapper.selectStoreroomUseList(storeUseVO);
    }

    /**
     * 新增使用记录
     *
     * @param storeUseVO 使用记录
     * @return 结果
     */
    @Override
    public int insertStoreroomUse(StoreUseVO storeUseVO)
    {
        storeUseVO.setCreateTime(DateUtils.getNowDate());
        return storeroomUseMapper.insertStoreroomUse(storeUseVO);
    }

    /**
     * 修改使用记录
     * 
     * @param storeroomUse 使用记录
     * @return 结果
     */
    @Override
    public int updateStoreroomUse(StoreroomUse storeroomUse)
    {
        storeroomUse.setUpdateTime(DateUtils.getNowDate());
        return storeroomUseMapper.updateStoreroomUse(storeroomUse);
    }

    /**
     * 批量删除使用记录
     * 
     * @param storeIds 需要删除的使用记录主键
     * @return 结果
     */
    @Override
    public int deleteStoreroomUseByStoreIds(String storeIds)
    {
        return storeroomUseMapper.deleteStoreroomUseByStoreIds(Convert.toStrArray(storeIds));
    }

    /**
     * 删除使用记录信息
     * 
     * @param storeId 使用记录主键
     * @return 结果
     */
    @Override
    public int deleteStoreroomUseByStoreId(Long storeId)
    {
        return storeroomUseMapper.deleteStoreroomUseByStoreId(storeId);
    }
}
